﻿using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;
using System.Configuration;

namespace Gp.Examples.FullCalendar.Infrastructure
{
    public static class Resolver
    {
        public static T Resolve<T>() where T : class
        {
            var container = new UnityContainer();
            var section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
            if (section == null)
                return null;
            section.Containers.Default.Configure(container);

            return container.Resolve<T>();
        }
    }
}